package dapps.entity.monitor;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

import dapps.entity.IdEntity;
import dapps.entity.user.Type;

@Entity
@Table(name = "element")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class Element extends IdEntity {
	private static final long serialVersionUID = -1021612791351928005L;

	private java.lang.String name;
	private java.lang.Integer numbertype;
	private java.lang.Integer rank;	
	private java.lang.String unit;
	private Type type;

	public Element() {
	}

	@ManyToOne(cascade = { CascadeType.PERSIST, CascadeType.MERGE })
	@JoinColumn(name = "typeid")
	@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
	public Type getType() {
		return type;
	}

	public java.lang.String getName() {
		return name;
	}

	public void setType(Type type) {
		this.type = type;
	}

	public void setName(java.lang.String name) {
		this.name = name;
	}


	public java.lang.Integer getNumbertype() {
		return numbertype;
	}

	public void setNumbertype(java.lang.Integer numbertype) {
		this.numbertype = numbertype;
	}


	public java.lang.Integer getRank() {
		return rank;
	}

	public void setRank(java.lang.Integer rank) {
		this.rank = rank;
	}

	public java.lang.String getUnit() {
		return unit;
	}

	public void setUnit(java.lang.String unit) {
		this.unit = unit;
	}

	/**
	 * @see java.lang.Object#toString()
	 */
	public String toString() {
		return this.getName();
	}

}
